# -*- codeing = utf-8 -*-
# @Time : 2021/2/26 19:12
# @Atuthor: 朱朱
# @File: 120私有属性的继承特点.py
# @Software: PyCharm

class Animal(object):

    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.__money = 10000

    def eat(self):
        print(self.name,'正在吃东西')

    def __test(self):
        print('我是animal里的私有方法__test')

class Person(Animal):
    def __demo(self):
        print('我是person里的私有方法__demo')


p = Person('jack',18)
print(p.name)
p.eat()
p._Animal__test()
p._Person__demo()
print(p._Animal__money)

# 父类里的私有属性的方法,子类不会继承
p._Person__test()
print(p._Person__money)